package com.cv.system.controller.system.logger.vo;

import com.cv.framework.common.pojo.PageResult;
import com.cv.framework.common.pojo.Result;
import com.cv.framework.operatelog.core.annotations.OperateLog;
import com.cv.system.controller.system.logger.vo.operateLog.OperateLogPageReqVO;
import com.cv.system.controller.system.logger.vo.operateLog.OperateLogRespVO;
import com.cv.system.service.logger.SystemOperateLogService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import static com.cv.framework.common.pojo.Result.success;

/**
 * 后台管理系统 - 操作日志
 *
 * @author Chalres_XDXD
 */
@Tag(name = "后台管理系统 - 操作日志")
@RestController
@RequestMapping("/system/operate-log")
@Validated
public class SystemOperateLogController {

    @Resource
    private SystemOperateLogService systemOperateLogService;

    @PostMapping("/page")
    @OperateLog(enable = false)
    @Operation(summary = "查看操作日志分页列表")
    public Result<PageResult<OperateLogRespVO>> pageOperateLog(@RequestBody OperateLogPageReqVO pageReqVO) {
        return success(systemOperateLogService.getOperateLogPage(pageReqVO));
    }
}
